package StoryGeneration 
{
	import org.flixel.FlxU;
	
	/**
	 * ...
	 * @author ...
	 */
	public class Story 
	{
		public var motive:String;
		public var murderer:String;
		public var location:String;
		public var means:String;
		
		private var motiveList:Array;
		private var locationList:Array;
		private var meansList:Array;
		
		public function Story()
		{
			motive = "none";
			murderer = "none";
			location = "none";
			means = "none";
			
			motiveList = new Array();
			meansList = new Array();
			
			var accidentList:Array = new Array(Relationship.WIFE, Relationship.SON, Relationship.BIZ_PARTNER, Relationship.SERVANT);
			var blackmailList:Array = new Array(Relationship.BIZ_PARTNER, Relationship.LOVER, Relationship.FRIEND, Relationship.SERVANT);
			var inheritanceList:Array = new Array(Relationship.WIFE, Relationship.SON, Relationship.LOVER, Relationship.FRIEND);
			var passionList:Array = new Array(Relationship.WIFE, Relationship.LOVER);
			var rivalryList:Array = new Array(Relationship.WIFE, Relationship.BIZ_PARTNER, Relationship.SERVANT);

			// Means lists
			var accidentMeansList:Array = new Array(Means.CANDLESTICK, Means.DAGGER, Means.GUN);
			var blackmailMeansList:Array = new Array(Means.DAGGER, Means.GUN, Means.POISON, Means.ROPE, Means.WIRE);
			var inheritanceMeansList:Array = new Array(Means.DAGGER, Means.GUN, Means.POISON, Means.ROPE, Means.WIRE);
			var rivalryMeansList:Array = new Array(Means.CANDLESTICK, Means.DAGGER, Means.GUN, Means.ROPE, Means.WIRE);
			var passionMeansList:Array = new Array(Means.CANDLESTICK, Means.DAGGER, Means.GUN, Means.POISON);
			
			locationList = new Array(	Location.BATHROOM, Location.BEDROOM, Location.BILLIARDS_ROOM,
												Location.DINING_ROOM, Location.FOYER, Location.GALLERY, Location.KITCHEN,
												Location.LOUNGE, Location.SERVANTS_ROOM);
			
			motiveList.push(new Rule(Motive.ACCIDENT, accidentList));
			motiveList.push(new Rule(Motive.BLACKMAIL, blackmailList));
			motiveList.push(new Rule(Motive.INHERITANCE, inheritanceList));
			motiveList.push(new Rule(Motive.PASSION, passionList));
			motiveList.push(new Rule(Motive.RIVALRY, rivalryList));
			
			meansList.push(new Rule(Motive.ACCIDENT, accidentMeansList));
			meansList.push(new Rule(Motive.BLACKMAIL, blackmailMeansList));
			meansList.push(new Rule(Motive.INHERITANCE, inheritanceMeansList));
			meansList.push(new Rule(Motive.PASSION, passionMeansList));
			meansList.push(new Rule(Motive.RIVALRY, rivalryMeansList));
		}
		
		public function generateStory():void
		{
			// First step is generating a motive for the crime.  This is the basic framework for the story.
			// Each motive can only apply to a subset of the characters in the game.
			// Blackmail: bus. assoc, lover, friend, servant
			// Passion: wife, lover
			// Inheritance: Wife, Child, Lover, Friend
			// Rivalry: Wife, bus. assoc, servant 
			// Accident: wife, child, bus. assoc, servant
			
			var motiveObject:Object = FlxU.getRandom(motiveList);
			var meansObject:Object = FlxU.getRandom(meansList);
			motive = Rule(motiveObject).motive;
			
			murderer = String(FlxU.getRandom(Rule(motiveObject).ruleList));
			means = String(FlxU.getRandom(Rule(meansObject).ruleList));
			location = String(FlxU.getRandom(locationList));
		}
		
		//public function GenerateKiller():String
		//{
			//return FlxU.getRandom(_ruleList);
		//}
		
	}

}